package com.order.util;

import com.order.entity.ResultEnum;
import lombok.Getter;

/**
 * @author iszengziqiang@163.com
 * @date 2021-08-25 15:06
 * @Version: 1.0
 * @desc
 */
@Getter
public class HandleException extends RuntimeException{
    /**
     * 状态码
     */
    private Integer code;

    /**
     * 信息描述
     */
    private String errorMsg;

    /**
     * Constructs a new runtime exception with {@code null} as its
     * detail message.  The cause is not initialized, and may subsequently be
     * initialized by a call to {@link #initCause}.
     */
    public HandleException(ResultEnum resultEnum) {
        this.code = resultEnum.getCode();
        this.errorMsg = resultEnum.getMsg();
    }
}
